"""
34 - Dars
"""
from bs import BeautifulSoup
import urllib.request

REQ = urllib.request.urlopen('https://www.ua-football.com/sport')
HTML = REQ.read()

SOUP = BeautifulSoup(HTML, 'html.parser')
NEWS = SOUP.find_all('li', class_='liga-news-item')

RESULTS = []

for item in NEWS:
    title = item.find('span', class_='d-block').get_text(strip=True)
    desc = item.find('span', class_='name-dop').get_text(strip=True)
    href = item.a.get('href')
    RESULTS.append({
        'title': title,
        'desc': desc,
        'href': href,
    })

F = open('news.txt', 'w', encoding='utf-8')
i = 1
for item in RESULTS:
    F.write(f'Ноость {i}\n\nНазние: {item["t"]}\nОисание: {item["d"]}\nСсылка: {item["h"]}\n\n*\n')
    i += 1
F.close()
